---
title: Develop websites with Expo
sidebar_title: Develop websites
description: Learn how to develop your app for the web so you can build a universal app.
hideTOC: true
---

import { RouterLogo } from '@expo/styleguide';
import { BookOpen02Icon } from '@expo/styleguide-icons/outline/BookOpen02Icon';
import { Cloud01Icon } from '@expo/styleguide-icons/outline/Cloud01Icon';

import { BoxLink } from '~/ui/components/BoxLink';
import { Collapsible } from '~/ui/components/Collapsible';
import { Terminal } from '~/ui/components/Snippet';
import { Tabs, Tab } from '~/ui/components/Tabs';
import { CODE } from '~/ui/components/Text';

Expo has first-class support for building full-stack websites with React. Expo websites can be [statically rendered](/router/web/static-rendering) for SEO and performance, or client-rendered for a more app-like experience in the browser.

<Tabs>

<Tab label="Universal">

    Render text on any platform with the `<Text>` component from [React Native for web](https://github.com/necolas/react-native-web).

    ```jsx app/index.js
    import { Text } from 'react-native';

    export default function Page() {
      return <Text>Home page</Text>;
    }
    ```

    React Native for web (RNW) is a set of component libraries such as `<View>`, and `<Text>`, that wrap `react-dom` primitives such as `<div>`, `<p>`, and `<img>`. RNW is optional when developing for web since you can use React DOM directly, but we often recommended it when building across platforms as it maximizes code reuse.

    > React Native for web is used to power the entire [X](https://x.com/) website.

</Tab>

<Tab label="Web-only">

    Alternatively, you can write web-only React DOM components such as `<div>`, `<p>`, and so on, however, these components won't render on native platforms.

    ```jsx app/index.js
    export default function Page() {
      return <p>Home page</p>;
    }
    ```

    Building web-only components is fully supported by Expo, however, you may want to organize your code to better support building for both web and native platforms simultaneously. Learn more in [platform-specific modules](/router/advanced/platform-specific-modules).

</Tab>

</Tabs>

All of the libraries in the Expo SDK are built to support both browser and server rendering environments (when applicable). Libraries are also optimized for the individual platforms they target.

Development features like Fast Refresh, debugging, environment variables, and [bundling](/guides/customizing-metro) are also fully universal, enabling a unified developer experience. Expo CLI **automatically optimizes code** for individual platforms when you build for production, using techniques like [platform shaking](/guides/tree-shaking#platform-shaking).

## Getting started

### Install web dependencies

<Terminal cmd={['$ npx expo install react-dom react-native-web @expo/metro-runtime']} />

<Collapsible summary={<>Not using the <CODE>expo</CODE> package in your app yet?</>}>

If you haven't added Expo to your React Native app yet, you can either [install Expo modules](/bare/installing-expo-modules/) (recommended) or just install the `expo` package and configure the app entry file. This will allow you to target web, but it will not include support for the Expo SDK.

1. Install [Expo CLI](/more/expo-cli/) in your project:

<Terminal cmd={['$ npm install expo']} />

2. Modify the entry file to use [`registerRootComponent`](/versions/latest/sdk/expo/#registerrootcomponentcomponent) instead of `AppRegistry.registerComponent`:

```diff
+ import {registerRootComponent} from 'expo';

import App from './App';
- import {AppRegistry} from 'react-native';
- import {name as appName} from './app.json';

- AppRegistry.registerComponent(appName, () => App);
+ registerRootComponent(App);
```

</Collapsible>

### Start the dev server

You can now start the dev server and develop in the browser with:

<Terminal cmd={['$ npx expo start --web']} cmdCopy="npx expo start --web" />

The app can be exported as a production website with:

<Terminal cmd={['$ npx expo export --platform web']} cmdCopy="npx expo export --platform web" />

## Next

<BoxLink
  title="File-based routing"
  description="Build routes and navigation with Expo Router."
  href="/router/introduction"
  Icon={RouterLogo}
/>

<BoxLink
  title="Static rendering and SEO"
  description="Render your website as static HTML with Expo Router to improve SEO and performance."
  href="/router/web/static-rendering"
  Icon={RouterLogo}
/>

<BoxLink
  title="Deploy instantly with EAS Hosting"
  description="EAS Hosting is the best way to deploy your Expo Router and React Native web apps with support for custom domains, SSL, and more."
  href="/eas/hosting/get-started"
  Icon={Cloud01Icon}
/>

<BoxLink
  title="Customizing the JavaScript bundler"
  description="Customize Metro bundler for your project."
  href="/guides/customizing-metro"
  Icon={BookOpen02Icon}
/>
